package com.crm.cc;

import android.text.TextUtils;

import com.google.gson.Gson;
import com.luck.picture.lib.entity.LocalMedia;

import java.io.File;

public class MyLocalMedia extends LocalMedia{
    private String pathName;
    private String compressPathName;


    public static MyLocalMedia pare(String lm) {
        Gson gson=new Gson();
        MyLocalMedia m=   gson.fromJson(lm,MyLocalMedia.class);
        m.pathName=m.getPathName();
        m.compressPathName=m.getCompressPathName();
        return  m;
    }

    public String getPathName() {
        String pa=getPath();
        if (!TextUtils.isEmpty(pa)){
            File file=new File(pa);
            if (file.exists()){
                return    file.getName();
            }
        }
        return pathName;
    }

    public void setPathName(String pathName) {
        this.pathName = pathName;
    }

    public String getCompressPathName() {
        String pa=getCompressPath();
        if (!TextUtils.isEmpty(pa)){
            File file=new File(pa);
            if (file.exists()){
                return    file.getName();
            }
        }
        return compressPathName;
    }

    public void setCompressPathName(String compressPathName) {
        this.compressPathName = compressPathName;
    }


}
